<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span id="local-6989586621681023138"><span id="local-6989586621681023139"></span></span><span class="hs-pragma">{-# LANGUAGE RecordWildCards #-}</span><span>
</span><span id="line-2"></span><span>
</span><span id="line-3"></span><span class="hs-comment">-- | Put common type definitions here to break recursive module dependencies.</span><span>
</span><span id="line-4"></span><span>
</span><span id="line-5"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHC.CmmToAsm.Reg.Linear.Base</span><span> </span><span class="hs-special">(</span><span>
</span><span id="line-6"></span><span>        </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#BlockAssignment"><span class="hs-identifier">BlockAssignment</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-7"></span><span>        </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#lookupBlockAssignment"><span class="hs-identifier">lookupBlockAssignment</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-8"></span><span>        </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#lookupFirstUsed"><span class="hs-identifier">lookupFirstUsed</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-9"></span><span>        </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#emptyBlockAssignment"><span class="hs-identifier">emptyBlockAssignment</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-10"></span><span>        </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#updateBlockAssignment"><span class="hs-identifier">updateBlockAssignment</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-11"></span><span>
</span><span id="line-12"></span><span>        </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#Loc"><span class="hs-identifier">Loc</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-13"></span><span>        </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#regsOfLoc"><span class="hs-identifier">regsOfLoc</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-14"></span><span>
</span><span id="line-15"></span><span>        </span><span class="hs-comment">-- for stats</span><span>
</span><span id="line-16"></span><span>        </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#SpillReason"><span class="hs-identifier">SpillReason</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-17"></span><span>        </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#RegAllocStats"><span class="hs-identifier">RegAllocStats</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-18"></span><span>
</span><span id="line-19"></span><span>        </span><span class="hs-comment">-- the allocator monad</span><span>
</span><span id="line-20"></span><span>        </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#RA_State"><span class="hs-identifier">RA_State</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-21"></span><span class="hs-special">)</span><span>
</span><span id="line-22"></span><span>
</span><span id="line-23"></span><span class="hs-keyword">where</span><span>
</span><span id="line-24"></span><span>
</span><span id="line-25"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Prelude.html"><span class="hs-identifier">GHC.Prelude</span></a></span><span>
</span><span id="line-26"></span><span>
</span><span id="line-27"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.StackMap.html"><span class="hs-identifier">GHC.CmmToAsm.Reg.Linear.StackMap</span></a></span><span>
</span><span id="line-28"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html"><span class="hs-identifier">GHC.CmmToAsm.Reg.Liveness</span></a></span><span>
</span><span id="line-29"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Config.html"><span class="hs-identifier">GHC.CmmToAsm.Config</span></a></span><span>
</span><span id="line-30"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html"><span class="hs-identifier">GHC.Platform.Reg</span></a></span><span>
</span><span id="line-31"></span><span>
</span><span id="line-32"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html"><span class="hs-identifier">GHC.Utils.Outputable</span></a></span><span>
</span><span id="line-33"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Unique.html"><span class="hs-identifier">GHC.Types.Unique</span></a></span><span>
</span><span id="line-34"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Unique.FM.html"><span class="hs-identifier">GHC.Types.Unique.FM</span></a></span><span>
</span><span id="line-35"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Unique.Supply.html"><span class="hs-identifier">GHC.Types.Unique.Supply</span></a></span><span>
</span><span id="line-36"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Cmm.BlockId.html"><span class="hs-identifier">GHC.Cmm.BlockId</span></a></span><span>
</span><span id="line-37"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Cmm.Dataflow.Collections.html"><span class="hs-identifier">GHC.Cmm.Dataflow.Collections</span></a></span><span>
</span><span id="line-38"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Utils.html"><span class="hs-identifier">GHC.CmmToAsm.Reg.Utils</span></a></span><span>
</span><span id="line-39"></span><span>
</span><span id="line-40"></span><span class="hs-keyword">data</span><span> </span><span id="ReadingOrWriting"><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#ReadingOrWriting"><span class="hs-identifier hs-var">ReadingOrWriting</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="Reading"><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#Reading"><span class="hs-identifier hs-var">Reading</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span id="Writing"><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#Writing"><span class="hs-identifier hs-var">Writing</span></a></span></span><span> </span><span class="hs-keyword">deriving</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681023127"><span id="local-6989586621681023129"><span class="annot"><span class="annottext">ReadingOrWriting -&gt; ReadingOrWriting -&gt; Bool
(ReadingOrWriting -&gt; ReadingOrWriting -&gt; Bool)
-&gt; (ReadingOrWriting -&gt; ReadingOrWriting -&gt; Bool)
-&gt; Eq ReadingOrWriting
forall a. (a -&gt; a -&gt; Bool) -&gt; (a -&gt; a -&gt; Bool) -&gt; Eq a
/= :: ReadingOrWriting -&gt; ReadingOrWriting -&gt; Bool
$c/= :: ReadingOrWriting -&gt; ReadingOrWriting -&gt; Bool
== :: ReadingOrWriting -&gt; ReadingOrWriting -&gt; Bool
$c== :: ReadingOrWriting -&gt; ReadingOrWriting -&gt; Bool
</span><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var">Eq</span></span></span></span><span class="hs-special">,</span><span id="local-6989586621681023107"><span id="local-6989586621681023109"><span id="local-6989586621681023112"><span id="local-6989586621681023115"><span id="local-6989586621681023118"><span id="local-6989586621681023120"><span id="local-6989586621681023122"><span class="annot"><span class="annottext">Eq ReadingOrWriting
Eq ReadingOrWriting
-&gt; (ReadingOrWriting -&gt; ReadingOrWriting -&gt; Ordering)
-&gt; (ReadingOrWriting -&gt; ReadingOrWriting -&gt; Bool)
-&gt; (ReadingOrWriting -&gt; ReadingOrWriting -&gt; Bool)
-&gt; (ReadingOrWriting -&gt; ReadingOrWriting -&gt; Bool)
-&gt; (ReadingOrWriting -&gt; ReadingOrWriting -&gt; Bool)
-&gt; (ReadingOrWriting -&gt; ReadingOrWriting -&gt; ReadingOrWriting)
-&gt; (ReadingOrWriting -&gt; ReadingOrWriting -&gt; ReadingOrWriting)
-&gt; Ord ReadingOrWriting
ReadingOrWriting -&gt; ReadingOrWriting -&gt; Bool
ReadingOrWriting -&gt; ReadingOrWriting -&gt; Ordering
ReadingOrWriting -&gt; ReadingOrWriting -&gt; ReadingOrWriting
forall a.
Eq a
-&gt; (a -&gt; a -&gt; Ordering)
-&gt; (a -&gt; a -&gt; Bool)
-&gt; (a -&gt; a -&gt; Bool)
-&gt; (a -&gt; a -&gt; Bool)
-&gt; (a -&gt; a -&gt; Bool)
-&gt; (a -&gt; a -&gt; a)
-&gt; (a -&gt; a -&gt; a)
-&gt; Ord a
min :: ReadingOrWriting -&gt; ReadingOrWriting -&gt; ReadingOrWriting
$cmin :: ReadingOrWriting -&gt; ReadingOrWriting -&gt; ReadingOrWriting
max :: ReadingOrWriting -&gt; ReadingOrWriting -&gt; ReadingOrWriting
$cmax :: ReadingOrWriting -&gt; ReadingOrWriting -&gt; ReadingOrWriting
&gt;= :: ReadingOrWriting -&gt; ReadingOrWriting -&gt; Bool
$c&gt;= :: ReadingOrWriting -&gt; ReadingOrWriting -&gt; Bool
&gt; :: ReadingOrWriting -&gt; ReadingOrWriting -&gt; Bool
$c&gt; :: ReadingOrWriting -&gt; ReadingOrWriting -&gt; Bool
&lt;= :: ReadingOrWriting -&gt; ReadingOrWriting -&gt; Bool
$c&lt;= :: ReadingOrWriting -&gt; ReadingOrWriting -&gt; Bool
&lt; :: ReadingOrWriting -&gt; ReadingOrWriting -&gt; Bool
$c&lt; :: ReadingOrWriting -&gt; ReadingOrWriting -&gt; Bool
compare :: ReadingOrWriting -&gt; ReadingOrWriting -&gt; Ordering
$ccompare :: ReadingOrWriting -&gt; ReadingOrWriting -&gt; Ordering
</span><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var">Ord</span></span></span></span></span></span></span></span></span><span class="hs-special">)</span><span>
</span><span id="line-41"></span><span>
</span><span id="line-42"></span><span class="hs-comment">-- | Used to store the register assignment on entry to a basic block.</span><span>
</span><span id="line-43"></span><span class="hs-comment">--      We use this to handle join points, where multiple branch instructions</span><span>
</span><span id="line-44"></span><span class="hs-comment">--      target a particular label. We have to insert fixup code to make</span><span>
</span><span id="line-45"></span><span class="hs-comment">--      the register assignments from the different sources match up.</span><span>
</span><span id="line-46"></span><span class="hs-comment">--</span><span>
</span><span id="line-47"></span><span class="hs-keyword">data</span><span> </span><span id="BlockAssignment"><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#BlockAssignment"><span class="hs-identifier hs-var">BlockAssignment</span></a></span></span><span> </span><span id="local-6989586621681023221"><span class="annot"><a href="#local-6989586621681023221"><span class="hs-identifier hs-type">freeRegs</span></a></span></span><span>
</span><span id="line-48"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span id="BlockAssignment"><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#BlockAssignment"><span class="hs-identifier hs-var">BlockAssignment</span></a></span></span><span> </span><span class="hs-special">{</span><span> </span><span id="blockMap"><span class="annot"><span class="annottext">forall freeRegs.
BlockAssignment freeRegs -&gt; BlockMap (freeRegs, RegMap Loc)
</span><a href="GHC.CmmToAsm.Reg.Linear.Base.html#blockMap"><span class="hs-identifier hs-var hs-var">blockMap</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-glyph">!</span><span class="hs-special">(</span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html#BlockMap"><span class="hs-identifier hs-type">BlockMap</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621681023221"><span class="hs-identifier hs-type">freeRegs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html#RegMap"><span class="hs-identifier hs-type">RegMap</span></a></span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#Loc"><span class="hs-identifier hs-type">Loc</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-49"></span><span>                          </span><span class="hs-special">,</span><span> </span><span id="firstUsed"><span class="annot"><span class="annottext">forall freeRegs.
BlockAssignment freeRegs -&gt; UniqFM VirtualReg RealReg
</span><a href="GHC.CmmToAsm.Reg.Linear.Base.html#firstUsed"><span class="hs-identifier hs-var hs-var">firstUsed</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-glyph">!</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Unique.FM.html#UniqFM"><span class="hs-identifier hs-type">UniqFM</span></a></span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#VirtualReg"><span class="hs-identifier hs-type">VirtualReg</span></a></span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#RealReg"><span class="hs-identifier hs-type">RealReg</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-50"></span><span>
</span><span id="line-51"></span><span class="hs-comment">-- | Find the register mapping for a specific BlockId.</span><span>
</span><span id="line-52"></span><span id="local-6989586621681023211"><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#lookupBlockAssignment"><span class="hs-identifier hs-type">lookupBlockAssignment</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Cmm.BlockId.html#BlockId"><span class="hs-identifier hs-type">BlockId</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#BlockAssignment"><span class="hs-identifier hs-type">BlockAssignment</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681023211"><span class="hs-identifier hs-type">freeRegs</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621681023211"><span class="hs-identifier hs-type">freeRegs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html#RegMap"><span class="hs-identifier hs-type">RegMap</span></a></span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#Loc"><span class="hs-identifier hs-type">Loc</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-53"></span><span id="lookupBlockAssignment"><span class="annot"><span class="annottext">lookupBlockAssignment :: forall freeRegs.
BlockId -&gt; BlockAssignment freeRegs -&gt; Maybe (freeRegs, RegMap Loc)
</span><a href="GHC.CmmToAsm.Reg.Linear.Base.html#lookupBlockAssignment"><span class="hs-identifier hs-var hs-var">lookupBlockAssignment</span></a></span></span><span> </span><span id="local-6989586621681023100"><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681023100"><span class="hs-identifier hs-var">bid</span></a></span></span><span> </span><span id="local-6989586621681023099"><span class="annot"><span class="annottext">BlockAssignment freeRegs
</span><a href="#local-6989586621681023099"><span class="hs-identifier hs-var">ba</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">KeyOf LabelMap
-&gt; LabelMap (freeRegs, RegMap Loc) -&gt; Maybe (freeRegs, RegMap Loc)
forall (map :: * -&gt; *) a.
IsMap map =&gt;
KeyOf map -&gt; map a -&gt; Maybe a
</span><a href="GHC.Cmm.Dataflow.Collections.html#mapLookup"><span class="hs-identifier hs-var">mapLookup</span></a></span><span> </span><span class="annot"><span class="annottext">KeyOf LabelMap
BlockId
</span><a href="#local-6989586621681023100"><span class="hs-identifier hs-var">bid</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">BlockAssignment freeRegs -&gt; LabelMap (freeRegs, RegMap Loc)
forall freeRegs.
BlockAssignment freeRegs -&gt; BlockMap (freeRegs, RegMap Loc)
</span><a href="GHC.CmmToAsm.Reg.Linear.Base.html#blockMap"><span class="hs-identifier hs-var hs-var">blockMap</span></a></span><span> </span><span class="annot"><span class="annottext">BlockAssignment freeRegs
</span><a href="#local-6989586621681023099"><span class="hs-identifier hs-var">ba</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-54"></span><span>
</span><span id="line-55"></span><span class="hs-comment">-- | Lookup which register a virtual register was first assigned to.</span><span>
</span><span id="line-56"></span><span id="local-6989586621681023204"><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#lookupFirstUsed"><span class="hs-identifier hs-type">lookupFirstUsed</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#VirtualReg"><span class="hs-identifier hs-type">VirtualReg</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#BlockAssignment"><span class="hs-identifier hs-type">BlockAssignment</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681023204"><span class="hs-identifier hs-type">freeRegs</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#RealReg"><span class="hs-identifier hs-type">RealReg</span></a></span></span><span>
</span><span id="line-57"></span><span id="lookupFirstUsed"><span class="annot"><span class="annottext">lookupFirstUsed :: forall freeRegs.
VirtualReg -&gt; BlockAssignment freeRegs -&gt; Maybe RealReg
</span><a href="GHC.CmmToAsm.Reg.Linear.Base.html#lookupFirstUsed"><span class="hs-identifier hs-var hs-var">lookupFirstUsed</span></a></span></span><span> </span><span id="local-6989586621681023095"><span class="annot"><span class="annottext">VirtualReg
</span><a href="#local-6989586621681023095"><span class="hs-identifier hs-var">vr</span></a></span></span><span> </span><span id="local-6989586621681023094"><span class="annot"><span class="annottext">BlockAssignment freeRegs
</span><a href="#local-6989586621681023094"><span class="hs-identifier hs-var">ba</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UniqFM VirtualReg RealReg -&gt; VirtualReg -&gt; Maybe RealReg
forall key elt. Uniquable key =&gt; UniqFM key elt -&gt; key -&gt; Maybe elt
</span><a href="GHC.Types.Unique.FM.html#lookupUFM"><span class="hs-identifier hs-var">lookupUFM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">BlockAssignment freeRegs -&gt; UniqFM VirtualReg RealReg
forall freeRegs.
BlockAssignment freeRegs -&gt; UniqFM VirtualReg RealReg
</span><a href="GHC.CmmToAsm.Reg.Linear.Base.html#firstUsed"><span class="hs-identifier hs-var hs-var">firstUsed</span></a></span><span> </span><span class="annot"><span class="annottext">BlockAssignment freeRegs
</span><a href="#local-6989586621681023094"><span class="hs-identifier hs-var">ba</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">VirtualReg
</span><a href="#local-6989586621681023095"><span class="hs-identifier hs-var">vr</span></a></span><span>
</span><span id="line-58"></span><span>
</span><span id="line-59"></span><span class="hs-comment">-- | An initial empty 'BlockAssignment'</span><span>
</span><span id="line-60"></span><span id="local-6989586621681023199"><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#emptyBlockAssignment"><span class="hs-identifier hs-type">emptyBlockAssignment</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#BlockAssignment"><span class="hs-identifier hs-type">BlockAssignment</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681023199"><span class="hs-identifier hs-type">freeRegs</span></a></span></span><span>
</span><span id="line-61"></span><span id="emptyBlockAssignment"><span class="annot"><span class="annottext">emptyBlockAssignment :: forall freeRegs. BlockAssignment freeRegs
</span><a href="GHC.CmmToAsm.Reg.Linear.Base.html#emptyBlockAssignment"><span class="hs-identifier hs-var hs-var">emptyBlockAssignment</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">BlockMap (freeRegs, RegMap Loc)
-&gt; UniqFM VirtualReg RealReg -&gt; BlockAssignment freeRegs
forall freeRegs.
BlockMap (freeRegs, RegMap Loc)
-&gt; UniqFM VirtualReg RealReg -&gt; BlockAssignment freeRegs
</span><a href="GHC.CmmToAsm.Reg.Linear.Base.html#BlockAssignment"><span class="hs-identifier hs-var">BlockAssignment</span></a></span><span> </span><span class="annot"><span class="annottext">BlockMap (freeRegs, RegMap Loc)
forall (map :: * -&gt; *) a. IsMap map =&gt; map a
</span><a href="GHC.Cmm.Dataflow.Collections.html#mapEmpty"><span class="hs-identifier hs-var">mapEmpty</span></a></span><span> </span><span class="annot"><span class="annottext">UniqFM VirtualReg RealReg
forall a. Monoid a =&gt; a
</span><a href="../../base/src/GHC.Base.html#mempty"><span class="hs-identifier hs-var">mempty</span></a></span><span>
</span><span id="line-62"></span><span>
</span><span id="line-63"></span><span class="hs-comment">-- | Add new register mappings for a specific block.</span><span>
</span><span id="line-64"></span><span id="local-6989586621681023193"><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#updateBlockAssignment"><span class="hs-identifier hs-type">updateBlockAssignment</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Cmm.BlockId.html#BlockId"><span class="hs-identifier hs-type">BlockId</span></a></span><span>
</span><span id="line-65"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621681023193"><span class="hs-identifier hs-type">freeRegs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html#RegMap"><span class="hs-identifier hs-type">RegMap</span></a></span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#Loc"><span class="hs-identifier hs-type">Loc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-66"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#BlockAssignment"><span class="hs-identifier hs-type">BlockAssignment</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681023193"><span class="hs-identifier hs-type">freeRegs</span></a></span><span>
</span><span id="line-67"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#BlockAssignment"><span class="hs-identifier hs-type">BlockAssignment</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681023193"><span class="hs-identifier hs-type">freeRegs</span></a></span></span><span>
</span><span id="line-68"></span><span id="updateBlockAssignment"><span class="annot"><span class="annottext">updateBlockAssignment :: forall freeRegs.
BlockId
-&gt; (freeRegs, RegMap Loc)
-&gt; BlockAssignment freeRegs
-&gt; BlockAssignment freeRegs
</span><a href="GHC.CmmToAsm.Reg.Linear.Base.html#updateBlockAssignment"><span class="hs-identifier hs-var hs-var">updateBlockAssignment</span></a></span></span><span> </span><span id="local-6989586621681023087"><span class="annot"><span class="annottext">BlockId
</span><a href="#local-6989586621681023087"><span class="hs-identifier hs-var">dest</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681023086"><span class="annot"><span class="annottext">freeRegs
</span><a href="#local-6989586621681023086"><span class="hs-identifier hs-var">freeRegs</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681023085"><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681023085"><span class="hs-identifier hs-var">regMap</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#BlockAssignment"><span class="hs-identifier hs-type">BlockAssignment</span></a></span><span> </span><span class="hs-special">{</span><span id="local-6989586621681023083"><span id="local-6989586621681023084"><span class="annot"><span class="annottext">UniqFM VirtualReg RealReg
BlockMap (freeRegs, RegMap Loc)
firstUsed :: UniqFM VirtualReg RealReg
blockMap :: BlockMap (freeRegs, RegMap Loc)
firstUsed :: forall freeRegs.
BlockAssignment freeRegs -&gt; UniqFM VirtualReg RealReg
blockMap :: forall freeRegs.
BlockAssignment freeRegs -&gt; BlockMap (freeRegs, RegMap Loc)
</span><a href="#local-6989586621681023083"><span class="hs-glyph hs-var hs-var hs-var hs-var">..</span></a></span></span></span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-69"></span><span>  </span><span class="annot"><span class="annottext">BlockMap (freeRegs, RegMap Loc)
-&gt; UniqFM VirtualReg RealReg -&gt; BlockAssignment freeRegs
forall freeRegs.
BlockMap (freeRegs, RegMap Loc)
-&gt; UniqFM VirtualReg RealReg -&gt; BlockAssignment freeRegs
</span><a href="GHC.CmmToAsm.Reg.Linear.Base.html#BlockAssignment"><span class="hs-identifier hs-var">BlockAssignment</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">KeyOf LabelMap
-&gt; (freeRegs, RegMap Loc)
-&gt; BlockMap (freeRegs, RegMap Loc)
-&gt; BlockMap (freeRegs, RegMap Loc)
forall (map :: * -&gt; *) a.
IsMap map =&gt;
KeyOf map -&gt; a -&gt; map a -&gt; map a
</span><a href="GHC.Cmm.Dataflow.Collections.html#mapInsert"><span class="hs-identifier hs-var">mapInsert</span></a></span><span> </span><span class="annot"><span class="annottext">KeyOf LabelMap
BlockId
</span><a href="#local-6989586621681023087"><span class="hs-identifier hs-var">dest</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">freeRegs
</span><a href="#local-6989586621681023086"><span class="hs-identifier hs-var">freeRegs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681023085"><span class="hs-identifier hs-var">regMap</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">BlockMap (freeRegs, RegMap Loc)
</span><a href="#local-6989586621681023084"><span class="hs-identifier hs-var">blockMap</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-70"></span><span>                  </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(RealReg -&gt; Loc -&gt; Maybe RealReg)
-&gt; (UniqFM VirtualReg RealReg -&gt; UniqFM VirtualReg RealReg)
-&gt; (UniqFM VirtualReg Loc -&gt; UniqFM VirtualReg RealReg)
-&gt; UniqFM VirtualReg RealReg
-&gt; UniqFM VirtualReg Loc
-&gt; UniqFM VirtualReg RealReg
forall elta eltb eltc key.
(elta -&gt; eltb -&gt; Maybe eltc)
-&gt; (UniqFM key elta -&gt; UniqFM key eltc)
-&gt; (UniqFM key eltb -&gt; UniqFM key eltc)
-&gt; UniqFM key elta
-&gt; UniqFM key eltb
-&gt; UniqFM key eltc
</span><a href="GHC.Types.Unique.FM.html#mergeUFM"><span class="hs-identifier hs-var">mergeUFM</span></a></span><span> </span><span class="annot"><span class="annottext">RealReg -&gt; Loc -&gt; Maybe RealReg
</span><a href="#local-6989586621681023080"><span class="hs-identifier hs-var">combWithExisting</span></a></span><span> </span><span class="annot"><span class="annottext">UniqFM VirtualReg RealReg -&gt; UniqFM VirtualReg RealReg
forall a. a -&gt; a
</span><a href="../../base/src/GHC.Base.html#id"><span class="hs-identifier hs-var">id</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Loc -&gt; Maybe RealReg)
-&gt; UniqFM VirtualReg Loc -&gt; UniqFM VirtualReg RealReg
forall elt1 elt2 key.
(elt1 -&gt; Maybe elt2) -&gt; UniqFM key elt1 -&gt; UniqFM key elt2
</span><a href="GHC.Types.Unique.FM.html#mapMaybeUFM"><span class="hs-identifier hs-var">mapMaybeUFM</span></a></span><span> </span><span class="annot"><span class="annottext">Loc -&gt; Maybe RealReg
</span><a href="#local-6989586621681023077"><span class="hs-identifier hs-var">fromLoc</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">UniqFM VirtualReg RealReg
</span><a href="#local-6989586621681023083"><span class="hs-identifier hs-var">firstUsed</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RegMap Loc -&gt; UniqFM VirtualReg Loc
forall elt. UniqFM Reg elt -&gt; UniqFM VirtualReg elt
</span><a href="GHC.CmmToAsm.Reg.Utils.html#toVRegMap"><span class="hs-identifier hs-var">toVRegMap</span></a></span><span> </span><span class="annot"><span class="annottext">RegMap Loc
</span><a href="#local-6989586621681023085"><span class="hs-identifier hs-var">regMap</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-71"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-72"></span><span>    </span><span class="hs-comment">-- The blocks are processed in dependency order, so if there's already an</span><span>
</span><span id="line-73"></span><span>    </span><span class="hs-comment">-- entry in the map then keep that assignment rather than writing the new</span><span>
</span><span id="line-74"></span><span>    </span><span class="hs-comment">-- assignment.</span><span>
</span><span id="line-75"></span><span>    </span><span class="annot"><a href="#local-6989586621681023080"><span class="hs-identifier hs-type">combWithExisting</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#RealReg"><span class="hs-identifier hs-type">RealReg</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#Loc"><span class="hs-identifier hs-type">Loc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#RealReg"><span class="hs-identifier hs-type">RealReg</span></a></span><span>
</span><span id="line-76"></span><span>    </span><span id="local-6989586621681023080"><span class="annot"><span class="annottext">combWithExisting :: RealReg -&gt; Loc -&gt; Maybe RealReg
</span><a href="#local-6989586621681023080"><span class="hs-identifier hs-var hs-var">combWithExisting</span></a></span></span><span> </span><span id="local-6989586621681023075"><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681023075"><span class="hs-identifier hs-var">old_reg</span></a></span></span><span> </span><span class="annot"><span class="annottext">Loc
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">RealReg -&gt; Maybe RealReg
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">(RealReg -&gt; Maybe RealReg) -&gt; RealReg -&gt; Maybe RealReg
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681023075"><span class="hs-identifier hs-var">old_reg</span></a></span><span>
</span><span id="line-77"></span><span>
</span><span id="line-78"></span><span>    </span><span class="annot"><a href="#local-6989586621681023077"><span class="hs-identifier hs-type">fromLoc</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#Loc"><span class="hs-identifier hs-type">Loc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Platform.Reg.html#RealReg"><span class="hs-identifier hs-type">RealReg</span></a></span><span>
</span><span id="line-79"></span><span>    </span><span id="local-6989586621681023077"><span class="annot"><span class="annottext">fromLoc :: Loc -&gt; Maybe RealReg
</span><a href="#local-6989586621681023077"><span class="hs-identifier hs-var hs-var">fromLoc</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#InReg"><span class="hs-identifier hs-type">InReg</span></a></span><span> </span><span id="local-6989586621681023073"><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681023073"><span class="hs-identifier hs-var">rr</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">RealReg -&gt; Maybe RealReg
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681023073"><span class="hs-identifier hs-var">rr</span></a></span><span>
</span><span id="line-80"></span><span>    </span><span class="annot"><a href="#local-6989586621681023077"><span class="hs-identifier hs-var">fromLoc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#InBoth"><span class="hs-identifier hs-type">InBoth</span></a></span><span> </span><span id="local-6989586621681023071"><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681023071"><span class="hs-identifier hs-var">rr</span></a></span></span><span> </span><span class="annot"><span class="annottext">StackSlot
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">RealReg -&gt; Maybe RealReg
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681023071"><span class="hs-identifier hs-var">rr</span></a></span><span>
</span><span id="line-81"></span><span>    </span><span class="annot"><a href="#local-6989586621681023077"><span class="hs-identifier hs-var">fromLoc</span></a></span><span> </span><span class="annot"><span class="annottext">Loc
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe RealReg
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-82"></span><span>
</span><span id="line-83"></span><span>
</span><span id="line-84"></span><span class="hs-comment">-- | Where a vreg is currently stored</span><span>
</span><span id="line-85"></span><span class="hs-comment">--      A temporary can be marked as living in both a register and memory</span><span>
</span><span id="line-86"></span><span class="hs-comment">--      (InBoth), for example if it was recently loaded from a spill location.</span><span>
</span><span id="line-87"></span><span class="hs-comment">--      This makes it cheap to spill (no save instruction required), but we</span><span>
</span><span id="line-88"></span><span class="hs-comment">--      have to be careful to turn this into InReg if the value in the</span><span>
</span><span id="line-89"></span><span class="hs-comment">--      register is changed.</span><span>
</span><span id="line-90"></span><span>
</span><span id="line-91"></span><span class="hs-comment">--      This is also useful when a temporary is about to be clobbered.  We</span><span>
</span><span id="line-92"></span><span class="hs-comment">--      save it in a spill location, but mark it as InBoth because the current</span><span>
</span><span id="line-93"></span><span class="hs-comment">--      instruction might still want to read it.</span><span>
</span><span id="line-94"></span><span class="hs-comment">--</span><span>
</span><span id="line-95"></span><span class="hs-keyword">data</span><span> </span><span id="Loc"><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#Loc"><span class="hs-identifier hs-var">Loc</span></a></span></span><span>
</span><span id="line-96"></span><span>        </span><span class="hs-comment">-- | vreg is in a register</span><span>
</span><span id="line-97"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span id="InReg"><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#InReg"><span class="hs-identifier hs-var">InReg</span></a></span></span><span>   </span><span class="hs-glyph">!</span><span class="annot"><a href="GHC.Platform.Reg.html#RealReg"><span class="hs-identifier hs-type">RealReg</span></a></span><span>
</span><span id="line-98"></span><span>
</span><span id="line-99"></span><span>        </span><span class="hs-comment">-- | vreg is held in a stack slot</span><span>
</span><span id="line-100"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span id="InMem"><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#InMem"><span class="hs-identifier hs-var">InMem</span></a></span></span><span>   </span><span class="hs-pragma">{-# UNPACK</span><span> </span><span class="hs-pragma">#-}</span><span>  </span><span class="hs-glyph">!</span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.StackMap.html#StackSlot"><span class="hs-identifier hs-type">StackSlot</span></a></span><span>
</span><span id="line-101"></span><span>
</span><span id="line-102"></span><span>
</span><span id="line-103"></span><span>        </span><span class="hs-comment">-- | vreg is held in both a register and a stack slot</span><span>
</span><span id="line-104"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span id="InBoth"><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#InBoth"><span class="hs-identifier hs-var">InBoth</span></a></span></span><span>   </span><span class="hs-glyph">!</span><span class="annot"><a href="GHC.Platform.Reg.html#RealReg"><span class="hs-identifier hs-type">RealReg</span></a></span><span>
</span><span id="line-105"></span><span>                   </span><span class="hs-pragma">{-# UNPACK</span><span> </span><span class="hs-pragma">#-}</span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.StackMap.html#StackSlot"><span class="hs-identifier hs-type">StackSlot</span></a></span><span>
</span><span id="line-106"></span><span>        </span><span class="hs-keyword">deriving</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681023060"><span id="local-6989586621681023068"><span class="annot"><span class="annottext">Loc -&gt; Loc -&gt; Bool
(Loc -&gt; Loc -&gt; Bool) -&gt; (Loc -&gt; Loc -&gt; Bool) -&gt; Eq Loc
forall a. (a -&gt; a -&gt; Bool) -&gt; (a -&gt; a -&gt; Bool) -&gt; Eq a
/= :: Loc -&gt; Loc -&gt; Bool
$c/= :: Loc -&gt; Loc -&gt; Bool
== :: Loc -&gt; Loc -&gt; Bool
$c== :: Loc -&gt; Loc -&gt; Bool
</span><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var">Eq</span></span></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681023044"><span id="local-6989586621681023046"><span id="local-6989586621681023058"><span class="annot"><span class="annottext">StackSlot -&gt; Loc -&gt; ShowS
[Loc] -&gt; ShowS
Loc -&gt; String
(StackSlot -&gt; Loc -&gt; ShowS)
-&gt; (Loc -&gt; String) -&gt; ([Loc] -&gt; ShowS) -&gt; Show Loc
forall a.
(StackSlot -&gt; a -&gt; ShowS)
-&gt; (a -&gt; String) -&gt; ([a] -&gt; ShowS) -&gt; Show a
showList :: [Loc] -&gt; ShowS
$cshowList :: [Loc] -&gt; ShowS
show :: Loc -&gt; String
$cshow :: Loc -&gt; String
showsPrec :: StackSlot -&gt; Loc -&gt; ShowS
$cshowsPrec :: StackSlot -&gt; Loc -&gt; ShowS
</span><a href="../../base/src/GHC.Show.html#Show"><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var">Show</span></a></span></span></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681023015"><span id="local-6989586621681023017"><span id="local-6989586621681023020"><span id="local-6989586621681023023"><span id="local-6989586621681023026"><span id="local-6989586621681023032"><span id="local-6989586621681023039"><span class="annot"><span class="annottext">Eq Loc
Eq Loc
-&gt; (Loc -&gt; Loc -&gt; Ordering)
-&gt; (Loc -&gt; Loc -&gt; Bool)
-&gt; (Loc -&gt; Loc -&gt; Bool)
-&gt; (Loc -&gt; Loc -&gt; Bool)
-&gt; (Loc -&gt; Loc -&gt; Bool)
-&gt; (Loc -&gt; Loc -&gt; Loc)
-&gt; (Loc -&gt; Loc -&gt; Loc)
-&gt; Ord Loc
Loc -&gt; Loc -&gt; Bool
Loc -&gt; Loc -&gt; Ordering
Loc -&gt; Loc -&gt; Loc
forall a.
Eq a
-&gt; (a -&gt; a -&gt; Ordering)
-&gt; (a -&gt; a -&gt; Bool)
-&gt; (a -&gt; a -&gt; Bool)
-&gt; (a -&gt; a -&gt; Bool)
-&gt; (a -&gt; a -&gt; Bool)
-&gt; (a -&gt; a -&gt; a)
-&gt; (a -&gt; a -&gt; a)
-&gt; Ord a
min :: Loc -&gt; Loc -&gt; Loc
$cmin :: Loc -&gt; Loc -&gt; Loc
max :: Loc -&gt; Loc -&gt; Loc
$cmax :: Loc -&gt; Loc -&gt; Loc
&gt;= :: Loc -&gt; Loc -&gt; Bool
$c&gt;= :: Loc -&gt; Loc -&gt; Bool
&gt; :: Loc -&gt; Loc -&gt; Bool
$c&gt; :: Loc -&gt; Loc -&gt; Bool
&lt;= :: Loc -&gt; Loc -&gt; Bool
$c&lt;= :: Loc -&gt; Loc -&gt; Bool
&lt; :: Loc -&gt; Loc -&gt; Bool
$c&lt; :: Loc -&gt; Loc -&gt; Bool
compare :: Loc -&gt; Loc -&gt; Ordering
$ccompare :: Loc -&gt; Loc -&gt; Ordering
</span><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var">Ord</span></span></span></span></span></span></span></span></span><span class="hs-special">)</span><span>
</span><span id="line-107"></span><span>
</span><span id="line-108"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621681023012"><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#Loc"><span class="hs-identifier hs-type">Loc</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-109"></span><span>        </span><span id="local-6989586621681023009"><span class="annot"><span class="annottext">ppr :: Loc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var hs-var hs-var hs-var">ppr</span></a></span></span><span> </span><span id="local-6989586621681023007"><span class="annot"><span class="annottext">Loc
</span><a href="#local-6989586621681023007"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Loc -&gt; String
forall a. Show a =&gt; a -&gt; String
</span><a href="../../base/src/GHC.Show.html#show"><span class="hs-identifier hs-var">show</span></a></span><span> </span><span class="annot"><span class="annottext">Loc
</span><a href="#local-6989586621681023007"><span class="hs-identifier hs-var">l</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-110"></span><span>
</span><span id="line-111"></span><span>
</span><span id="line-112"></span><span class="hs-comment">-- | Get the reg numbers stored in this Loc.</span><span>
</span><span id="line-113"></span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#regsOfLoc"><span class="hs-identifier hs-type">regsOfLoc</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#Loc"><span class="hs-identifier hs-type">Loc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Platform.Reg.html#RealReg"><span class="hs-identifier hs-type">RealReg</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-114"></span><span id="regsOfLoc"><span class="annot"><span class="annottext">regsOfLoc :: Loc -&gt; [RealReg]
</span><a href="GHC.CmmToAsm.Reg.Linear.Base.html#regsOfLoc"><span class="hs-identifier hs-var hs-var">regsOfLoc</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#InReg"><span class="hs-identifier hs-type">InReg</span></a></span><span> </span><span id="local-6989586621681023004"><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681023004"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681023004"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-115"></span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#regsOfLoc"><span class="hs-identifier hs-var">regsOfLoc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#InBoth"><span class="hs-identifier hs-type">InBoth</span></a></span><span> </span><span id="local-6989586621681023003"><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681023003"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span class="annot"><span class="annottext">StackSlot
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">RealReg
</span><a href="#local-6989586621681023003"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-116"></span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#regsOfLoc"><span class="hs-identifier hs-var">regsOfLoc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#InMem"><span class="hs-identifier hs-type">InMem</span></a></span><span> </span><span class="annot"><span class="annottext">StackSlot
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-117"></span><span>
</span><span id="line-118"></span><span>
</span><span id="line-119"></span><span class="hs-comment">-- | Reasons why instructions might be inserted by the spiller.</span><span>
</span><span id="line-120"></span><span class="hs-comment">--      Used when generating stats for -ddrop-asm-stats.</span><span>
</span><span id="line-121"></span><span class="hs-comment">--</span><span>
</span><span id="line-122"></span><span class="hs-keyword">data</span><span> </span><span id="SpillReason"><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#SpillReason"><span class="hs-identifier hs-var">SpillReason</span></a></span></span><span>
</span><span id="line-123"></span><span>        </span><span class="hs-comment">-- | vreg was spilled to a slot so we could use its</span><span>
</span><span id="line-124"></span><span>        </span><span class="hs-comment">--      current hreg for another vreg</span><span>
</span><span id="line-125"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span id="SpillAlloc"><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#SpillAlloc"><span class="hs-identifier hs-var">SpillAlloc</span></a></span></span><span>    </span><span class="hs-glyph">!</span><span class="annot"><a href="GHC.Types.Unique.html#Unique"><span class="hs-identifier hs-type">Unique</span></a></span><span>
</span><span id="line-126"></span><span>
</span><span id="line-127"></span><span>        </span><span class="hs-comment">-- | vreg was moved because its hreg was clobbered</span><span>
</span><span id="line-128"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span id="SpillClobber"><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#SpillClobber"><span class="hs-identifier hs-var">SpillClobber</span></a></span></span><span>  </span><span class="hs-glyph">!</span><span class="annot"><a href="GHC.Types.Unique.html#Unique"><span class="hs-identifier hs-type">Unique</span></a></span><span>
</span><span id="line-129"></span><span>
</span><span id="line-130"></span><span>        </span><span class="hs-comment">-- | vreg was loaded from a spill slot</span><span>
</span><span id="line-131"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span id="SpillLoad"><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#SpillLoad"><span class="hs-identifier hs-var">SpillLoad</span></a></span></span><span>     </span><span class="hs-glyph">!</span><span class="annot"><a href="GHC.Types.Unique.html#Unique"><span class="hs-identifier hs-type">Unique</span></a></span><span>
</span><span id="line-132"></span><span>
</span><span id="line-133"></span><span>        </span><span class="hs-comment">-- | reg-reg move inserted during join to targets</span><span>
</span><span id="line-134"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span id="SpillJoinRR"><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#SpillJoinRR"><span class="hs-identifier hs-var">SpillJoinRR</span></a></span></span><span>   </span><span class="hs-glyph">!</span><span class="annot"><a href="GHC.Types.Unique.html#Unique"><span class="hs-identifier hs-type">Unique</span></a></span><span>
</span><span id="line-135"></span><span>
</span><span id="line-136"></span><span>        </span><span class="hs-comment">-- | reg-mem move inserted during join to targets</span><span>
</span><span id="line-137"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span id="SpillJoinRM"><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#SpillJoinRM"><span class="hs-identifier hs-var">SpillJoinRM</span></a></span></span><span>   </span><span class="hs-glyph">!</span><span class="annot"><a href="GHC.Types.Unique.html#Unique"><span class="hs-identifier hs-type">Unique</span></a></span><span>
</span><span id="line-138"></span><span>
</span><span id="line-139"></span><span>
</span><span id="line-140"></span><span class="hs-comment">-- | Used to carry interesting stats out of the register allocator.</span><span>
</span><span id="line-141"></span><span class="hs-keyword">data</span><span> </span><span id="RegAllocStats"><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#RegAllocStats"><span class="hs-identifier hs-var">RegAllocStats</span></a></span></span><span>
</span><span id="line-142"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span id="RegAllocStats"><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#RegAllocStats"><span class="hs-identifier hs-var">RegAllocStats</span></a></span></span><span>
</span><span id="line-143"></span><span>        </span><span class="hs-special">{</span><span> </span><span id="ra_spillInstrs"><span class="annot"><span class="annottext">RegAllocStats -&gt; UniqFM Unique [StackSlot]
</span><a href="GHC.CmmToAsm.Reg.Linear.Base.html#ra_spillInstrs"><span class="hs-identifier hs-var hs-var">ra_spillInstrs</span></a></span></span><span>        </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Unique.FM.html#UniqFM"><span class="hs-identifier hs-type">UniqFM</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Unique.html#Unique"><span class="hs-identifier hs-type">Unique</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span class="hs-special">]</span><span> </span><span class="hs-comment">-- Keys are the uniques of regs</span><span>
</span><span id="line-144"></span><span>                                                       </span><span class="hs-comment">-- and taken from SpillReason</span><span>
</span><span id="line-145"></span><span>                                                       </span><span class="hs-comment">-- See Note [UniqFM and the register allocator]</span><span>
</span><span id="line-146"></span><span>        </span><span class="hs-special">,</span><span> </span><span id="ra_fixupList"><span class="annot"><span class="annottext">RegAllocStats -&gt; [(BlockId, BlockId, BlockId)]
</span><a href="GHC.CmmToAsm.Reg.Linear.Base.html#ra_fixupList"><span class="hs-identifier hs-var hs-var">ra_fixupList</span></a></span></span><span>     </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Cmm.BlockId.html#BlockId"><span class="hs-identifier hs-type">BlockId</span></a></span><span class="hs-special">,</span><span class="annot"><a href="GHC.Cmm.BlockId.html#BlockId"><span class="hs-identifier hs-type">BlockId</span></a></span><span class="hs-special">,</span><span class="annot"><a href="GHC.Cmm.BlockId.html#BlockId"><span class="hs-identifier hs-type">BlockId</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-147"></span><span>        </span><span class="hs-comment">-- ^ (from,fixup,to) : We inserted fixup code between from and to</span><span>
</span><span id="line-148"></span><span>        </span><span class="hs-special">}</span><span>
</span><span id="line-149"></span><span>
</span><span id="line-150"></span><span>
</span><span id="line-151"></span><span class="hs-comment">-- | The register allocator state</span><span>
</span><span id="line-152"></span><span class="hs-keyword">data</span><span> </span><span id="RA_State"><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#RA_State"><span class="hs-identifier hs-var">RA_State</span></a></span></span><span> </span><span id="local-6989586621681023169"><span class="annot"><a href="#local-6989586621681023169"><span class="hs-identifier hs-type">freeRegs</span></a></span></span><span>
</span><span id="line-153"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span id="RA_State"><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#RA_State"><span class="hs-identifier hs-var">RA_State</span></a></span></span><span>
</span><span id="line-154"></span><span>
</span><span id="line-155"></span><span>        </span><span class="hs-special">{</span><span>
</span><span id="line-156"></span><span>        </span><span class="hs-comment">-- | the current mapping from basic blocks to</span><span>
</span><span id="line-157"></span><span>        </span><span class="hs-comment">--      the register assignments at the beginning of that block.</span><span>
</span><span id="line-158"></span><span>          </span><span id="ra_blockassig"><span class="annot"><span class="annottext">forall freeRegs. RA_State freeRegs -&gt; BlockAssignment freeRegs
</span><a href="GHC.CmmToAsm.Reg.Linear.Base.html#ra_blockassig"><span class="hs-identifier hs-var hs-var">ra_blockassig</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#BlockAssignment"><span class="hs-identifier hs-type">BlockAssignment</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681023169"><span class="hs-identifier hs-type">freeRegs</span></a></span><span>
</span><span id="line-159"></span><span>
</span><span id="line-160"></span><span>        </span><span class="hs-comment">-- | free machine registers</span><span>
</span><span id="line-161"></span><span>        </span><span class="hs-special">,</span><span> </span><span id="ra_freeregs"><span class="annot"><span class="annottext">forall freeRegs. RA_State freeRegs -&gt; freeRegs
</span><a href="GHC.CmmToAsm.Reg.Linear.Base.html#ra_freeregs"><span class="hs-identifier hs-var hs-var">ra_freeregs</span></a></span></span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="#local-6989586621681023169"><span class="hs-identifier hs-type">freeRegs</span></a></span><span>
</span><span id="line-162"></span><span>
</span><span id="line-163"></span><span>        </span><span class="hs-comment">-- | assignment of temps to locations</span><span>
</span><span id="line-164"></span><span>        </span><span class="hs-special">,</span><span> </span><span id="ra_assig"><span class="annot"><span class="annottext">forall freeRegs. RA_State freeRegs -&gt; RegMap Loc
</span><a href="GHC.CmmToAsm.Reg.Linear.Base.html#ra_assig"><span class="hs-identifier hs-var hs-var">ra_assig</span></a></span></span><span>      </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Liveness.html#RegMap"><span class="hs-identifier hs-type">RegMap</span></a></span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#Loc"><span class="hs-identifier hs-type">Loc</span></a></span><span>
</span><span id="line-165"></span><span>
</span><span id="line-166"></span><span>        </span><span class="hs-comment">-- | current stack delta</span><span>
</span><span id="line-167"></span><span>        </span><span class="hs-special">,</span><span> </span><span id="ra_delta"><span class="annot"><span class="annottext">forall freeRegs. RA_State freeRegs -&gt; StackSlot
</span><a href="GHC.CmmToAsm.Reg.Linear.Base.html#ra_delta"><span class="hs-identifier hs-var hs-var">ra_delta</span></a></span></span><span>      </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span>
</span><span id="line-168"></span><span>
</span><span id="line-169"></span><span>        </span><span class="hs-comment">-- | free stack slots for spilling</span><span>
</span><span id="line-170"></span><span>        </span><span class="hs-special">,</span><span> </span><span id="ra_stack"><span class="annot"><span class="annottext">forall freeRegs. RA_State freeRegs -&gt; StackMap
</span><a href="GHC.CmmToAsm.Reg.Linear.Base.html#ra_stack"><span class="hs-identifier hs-var hs-var">ra_stack</span></a></span></span><span>      </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.StackMap.html#StackMap"><span class="hs-identifier hs-type">StackMap</span></a></span><span>
</span><span id="line-171"></span><span>
</span><span id="line-172"></span><span>        </span><span class="hs-comment">-- | unique supply for generating names for join point fixup blocks.</span><span>
</span><span id="line-173"></span><span>        </span><span class="hs-special">,</span><span> </span><span id="ra_us"><span class="annot"><span class="annottext">forall freeRegs. RA_State freeRegs -&gt; UniqSupply
</span><a href="GHC.CmmToAsm.Reg.Linear.Base.html#ra_us"><span class="hs-identifier hs-var hs-var">ra_us</span></a></span></span><span>         </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Unique.Supply.html#UniqSupply"><span class="hs-identifier hs-type">UniqSupply</span></a></span><span>
</span><span id="line-174"></span><span>
</span><span id="line-175"></span><span>        </span><span class="hs-comment">-- | Record why things were spilled, for -ddrop-asm-stats.</span><span>
</span><span id="line-176"></span><span>        </span><span class="hs-comment">--      Just keep a list here instead of a map of regs -&gt; reasons.</span><span>
</span><span id="line-177"></span><span>        </span><span class="hs-comment">--      We don't want to slow down the allocator if we're not going to emit the stats.</span><span>
</span><span id="line-178"></span><span>        </span><span class="hs-special">,</span><span> </span><span id="ra_spills"><span class="annot"><span class="annottext">forall freeRegs. RA_State freeRegs -&gt; [SpillReason]
</span><a href="GHC.CmmToAsm.Reg.Linear.Base.html#ra_spills"><span class="hs-identifier hs-var hs-var">ra_spills</span></a></span></span><span>     </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.CmmToAsm.Reg.Linear.Base.html#SpillReason"><span class="hs-identifier hs-type">SpillReason</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-179"></span><span>
</span><span id="line-180"></span><span>        </span><span class="hs-comment">-- | Native code generator configuration</span><span>
</span><span id="line-181"></span><span>        </span><span class="hs-special">,</span><span> </span><span id="ra_config"><span class="annot"><span class="annottext">forall freeRegs. RA_State freeRegs -&gt; NCGConfig
</span><a href="GHC.CmmToAsm.Reg.Linear.Base.html#ra_config"><span class="hs-identifier hs-var hs-var">ra_config</span></a></span></span><span>     </span><span class="hs-glyph">::</span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="GHC.CmmToAsm.Config.html#NCGConfig"><span class="hs-identifier hs-type">NCGConfig</span></a></span><span>
</span><span id="line-182"></span><span>
</span><span id="line-183"></span><span>        </span><span class="hs-comment">-- | (from,fixup,to) : We inserted fixup code between from and to</span><span>
</span><span id="line-184"></span><span>        </span><span class="hs-special">,</span><span> </span><span id="ra_fixups"><span class="annot"><span class="annottext">forall freeRegs. RA_State freeRegs -&gt; [(BlockId, BlockId, BlockId)]
</span><a href="GHC.CmmToAsm.Reg.Linear.Base.html#ra_fixups"><span class="hs-identifier hs-var hs-var">ra_fixups</span></a></span></span><span>     </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Cmm.BlockId.html#BlockId"><span class="hs-identifier hs-type">BlockId</span></a></span><span class="hs-special">,</span><span class="annot"><a href="GHC.Cmm.BlockId.html#BlockId"><span class="hs-identifier hs-type">BlockId</span></a></span><span class="hs-special">,</span><span class="annot"><a href="GHC.Cmm.BlockId.html#BlockId"><span class="hs-identifier hs-type">BlockId</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-185"></span><span>
</span><span id="line-186"></span><span>        </span><span class="hs-special">}</span><span>
</span><span id="line-187"></span><span>
</span><span id="line-188"></span><span>
</span><span id="line-189"></span></pre></body></html>